import React, { useEffect, useState } from "react";

export default function Test1() {
    console.log("test1");
    let [count,setCount] = useState(0);
    useEffect(() => {
        console.log("effect");
        setCount(100);
        return () => {
            console.log("clean");
        }
    },[count]);
    const handleClick = () => {
        setCount(count+1);
    }
    return <div>
        <p>计数器：{count}</p>
        <input type="button" value="加1" onClick={handleClick} />
    </div>;
}
